package com.cjm.mybatis.test1;

import com.cjm.mybatis.bean.User;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.IOException;
import java.io.InputStream;

/**
 * Created by jiaming.chen1 on 2015/7/7.
 */
public class Test {
    public static void main(String[] args) throws IOException {
        String resource = "conf.xml";
        InputStream is = Test.class.getClassLoader().getResourceAsStream(resource);

        SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(is);

        SqlSession session = factory.openSession();

        String statement = "com.cjm.mybatis.test2.userMapper.getUser";
/*
        User user = session.selectOne(statement, 2);
        System.out.println(user);*/

        int insert = session.insert(statement, new User(-1,"11", 11));

    }
}
